<template>
  <view>
    <!-- <view @tap="click(1111)">点击我试一试</view> -->
    <!-- 在小程序中的视频，建议应该使用oss(对象存储) oss支持cdn -->
    <video
      src="http://localhost/a.mp4"
      :controls="true"
      :autoplay="false"
      poster="http://www.codingke.com/files/default/2020/01-07/175835b27f36226482.png"
      :initial-time="0"
      id="video"
      :loop="false"
      :muted="false"
      @timeupdate="timeupdate"
    />
  </view>
</template>

<script>
import { getCurrentInstance } from "@tarojs/taro";
export default {
  data() {
    return {
      flag: 0,
    };
  },
  created() {
    console.log(getCurrentInstance().router.params.id);
  },
  methods: {
    click(num) {
      console.log("点击" + num);
    },
    // 视频发生更新时触发
    timeupdate(evt) {
      let time = Math.floor(evt.detail.currentTime);

      if(time  == 10 && this.flag == 0){
        console.log('10')
        this.flag = 1
      }
    },
  },
};
</script>

<style lang="scss" scope>
#video {
  width: 750px;
}
</style>
